Learn T-SQL Commands with Samples
Skip Navigation Links
Skip Navigation Links.
Expand DatabaseDatabase
Expand TableTable
Expand ViewView
Expand Stored ProcedureStored Procedure
Expand Data FilteringData Filtering
Expand Data GroupingData Grouping
Expand JoinsJoins
Collapse TriggerTrigger
Expand CursorCursor
Expand OperatorsOperators
Expand ConstraintsConstraints
Expand FunctionsFunctions
Expand Conditional ProcessingConditional Processing
Expand LoopingLooping
Expand Error HandlingError Handling
Expand v.IMP Queriesv.IMP Queries
Expand XMLXML
Expand Query PerformanceQuery Performance
Expand QueriesQueries
Expand NormalizationNormalization
Expand CreateCreate
     

Create After Trigger

 
      IF OBJECT_ID ('myAfterTrigger', 'TR') IS NOT NULL
          DROP TRIGGER myAfterTrigger
      go

      CREATE TRIGGER myAfterTrigger
        ON      myTable
        
      AFTER   INSERT, UPDATE, DELETE
      AS
        SELECT 'AFTER: Trigger Fired on'  as TriggerName,
        GETDATE()                         as Date_Time